/**
 * @sw-package framework
 */

import registerComponents from 'src/app/component';

const componentNames = [
    'sw-wizard-page',
    'sw-wizard-dot-navigation',
    'sw-wizard',
    'sw-vnode-renderer',
    'sw-verify-user-modal',
    'sw-upload-listener',
    'sw-time-ago',
    'sw-text-preview',
    'sw-step-item',
    'sw-step-display',
    'sw-status',
    'sw-skeleton-bar-deprecated',
    'sw-skeleton-bar',
    'sw-skeleton',
    'sw-shortcut-overview-item',
    'sw-shortcut-overview',
    'sw-provide',
    'sw-progress-bar',
    'sw-popover-deprecated',
    'sw-popover',
    'sw-overlay',
    'sw-notifications',
    'sw-notification-center-item',
    'sw-notification-center',
    'sw-loader-deprecated',
    'sw-loader',
    'sw-license-violation',
    'sw-internal-link',
    'sw-inherit-wrapper',
    'sw-ignore-class',
    'sw-external-link',
    'sw-error-boundary',
    'sw-duplicated-media-v2',
    'sw-color-badge',
    'sw-tree-item',
    'sw-tree-input-field',
    'sw-tree',
    'sw-skip-link',
    'sw-sidebar-renderer',
    'sw-search-more-results',
    'sw-search-bar-item',
    'sw-search-bar',
    'sw-sales-channel-switch',
    'sw-sales-channel-config',
    'sw-page',
    'sw-modals-renderer',
    'sw-language-switch',
    'sw-language-info',
    'sw-inheritance-warning',
    'sw-in-app-purchase-checkout',
    'sw-hidden-iframes',
    'sw-error',
    'sw-discard-changes-modal',
    'sw-desktop',
    'sw-card-view',
    'sw-block-parent',
    'sw-block',
    'sw-admin-menu-item',
    'sw-admin-menu',
    'sw-admin',
    'sw-sidebar-navigation-item',
    'sw-sidebar-item',
    'sw-sidebar',
    'sw-rule-modal',
    'sw-condition-unit-menu',
    'sw-condition-type-select',
    'sw-condition-tree-node',
    'sw-condition-tree',
    'sw-condition-or-container',
    'sw-condition-operator-select',
    'sw-condition-modal',
    'sw-condition-base',
    'sw-condition-and-container',
    'sw-condition-all-line-items-container',
    'sw-arrow-field',
    'sw-search-preferences-modal',
    'sw-image-preview-modal',
    'sw-confirm-modal',
    'mt-text-editor',
    'sw-text-editor-toolbar-button-link',
    'mt-tabs',
    'mt-datepicker',
    'mt-card',
    'sw-meteor-single-select',
    'sw-meteor-page',
    'sw-meteor-navigation',
    'sw-meteor-card',
    'sw-sortable-list',
    'sw-pagination',
    'sw-grid-row',
    'sw-grid-column',
    'sw-grid',
    'sw-url-field',
    'sw-textarea-field-deprecated',
    'sw-textarea-field',
    'sw-text-field-deprecated',
    'sw-text-field',
    'sw-text-editor',
    'sw-text-editor-toolbar-table-button',
    'sw-text-editor-toolbar-button',
    'sw-text-editor-toolbar',
    'sw-text-editor-table-toolbar',
    'sw-text-editor-link-menu',
    'sw-tagged-field',
    'sw-switch-field',
    'sw-snippet-field-edit-modal',
    'sw-snippet-field',
    'sw-select-rule-create',
    'sw-select-option',
    'sw-select-field-deprecated',
    'sw-select-field',
    'sw-radio-field',
    'sw-purchase-price-field',
    'sw-price-field',
    'sw-password-field',
    'sw-number-field',
    'sw-maintain-currencies-modal',
    'sw-list-price-field',
    'sw-gtc-checkbox',
    'sw-form-field-renderer',
    'sw-file-input',
    'sw-field-copyable',
    'sw-email-field',
    'sw-dynamic-url-field',
    'sw-custom-field-set-renderer',
    'sw-confirm-field',
    'sw-colorpicker-deprecated',
    'sw-colorpicker',
    'sw-checkbox-field-deprecated',
    'sw-checkbox-field',
    'sw-boolean-radio-group',
    'sw-entity-single-select',
    'sw-entity-multi-select',
    'sw-entity-multi-id-select',
    'sw-entity-many-to-many-select',
    'sw-entity-advanced-selection-modal',
    'sw-advanced-selection-rule',
    'sw-advanced-selection-product',
    'sw-single-select',
    'sw-select-selection-list',
    'sw-select-result-list',
    'sw-select-result',
    'sw-select-base',
    'sw-multi-tag-select',
    'sw-multi-select',
    'sw-field-error',
    'sw-contextual-field',
    'sw-block-field',
    'sw-base-field',
    'sw-sidebar-filter-panel',
    'sw-range-filter',
    'sw-number-filter',
    'sw-multi-select-filter',
    'sw-filter-panel',
    'sw-existence-filter',
    'sw-date-filter',
    'sw-boolean-filter',
    'sw-base-filter',
    'sw-iframe-renderer',
    'sw-extension-teaser-sales-channel',
    'sw-extension-teaser-popover',
    'sw-extension-component-section',
    'sw-product-stream-grid-preview',
    'sw-many-to-many-assignment-card',
    'sw-category-tree-field',
    'sw-bulk-edit-modal',
    'sw-data-grid-skeleton',
    'sw-data-grid-settings',
    'sw-data-grid-inline-edit',
    'sw-data-grid-column-position',
    'sw-data-grid-column-boolean',
    'sw-data-grid',
    'sw-context-menu-item',
    'sw-context-menu-divider',
    'sw-context-menu',
    'sw-context-button',
    'sw-version',
    'sw-user-card',
    'sw-tabs-item',
    'sw-tabs-deprecated',
    'sw-tabs',
    'sw-sorting-select',
    'sw-simple-search-field',
    'sw-rating-stars',
    'sw-radio-panel',
    'sw-property-search',
    'sw-product-variant-info',
    'sw-product-image',
    'sw-modal',
    'sw-label',
    'sw-inheritance-switch',
    'sw-icon-deprecated',
    'sw-icon',
    'sw-highlight-text',
    'sw-help-text',
    'sw-error-summary',
    'sw-empty-state',
    'sw-description-list',
    'sw-container',
    'sw-collapse',
    'sw-circle-icon',
    'sw-chart-card',
    'sw-card-section',
    'sw-card-filter',
    'sw-card-deprecated',
    'sw-card',
    'sw-button-process',
    'sw-button-group',
    'sw-button-deprecated',
    'sw-button',
    'sw-avatar',
    'sw-alert-deprecated',
    'sw-alert',
    'sw-address',
    'sw-app-wrong-app-url-modal',
    'sw-app-topbar-button',
    'sw-app-shop-id-change-modal',
    'sw-app-actions',
    'sw-app-action-button',
    'sw-code-editor',
    'sw-chart',
    'sw-help-center-v2',
    'sw-help-sidebar',
    'sw-datepicker',
    'sw-image-slider',
    'sw-media-add-thumbnail-form',
    'sw-media-base-item',
    'sw-media-compact-upload-v2',
    'sw-media-entity-mapper',
    'sw-media-field',
    'sw-media-folder-content',
    'sw-media-folder-item',
    'sw-media-list-selection-item-v2',
    'sw-media-list-selection-v2',
    'sw-media-media-item',
    'sw-media-modal-delete',
    'sw-media-modal-folder-dissolve',
    'sw-media-modal-folder-settings',
    'sw-media-modal-move',
    'sw-media-modal-replace',
    'sw-media-preview-v2',
    'sw-media-replace',
    'sw-media-upload-v2',
    'sw-media-url-form',
    'sw-sidebar-media-item',
    'sw-ai-copilot-badge',
    'sw-ai-copilot-warning',
    'sw-string-filter',
    'sw-sidebar-collapse',
    'sw-condition-is-net-select',
    'sw-condition-base-line-item',
    'sw-condition-time-range',
    'sw-condition-shipping-zip-code',
    'sw-condition-script',
    'sw-condition-order-custom-field',
    'sw-condition-not-found',
    'sw-condition-line-item-with-quantity',
    'sw-condition-line-item-purchase-price',
    'sw-condition-line-item-property',
    'sw-condition-line-item-in-category',
    'sw-condition-line-item-goods-total',
    'sw-condition-line-item-custom-field',
    'sw-condition-line-item',
    'sw-condition-is-always-valid',
    'sw-condition-goods-price',
    'sw-condition-goods-count',
    'sw-condition-generic-line-item',
    'sw-condition-generic',
    'sw-condition-date-range',
    'sw-condition-customer-custom-field',
    'sw-condition-billing-zip-code',
    'sw-url-field-deprecated',
    'sw-switch-field-deprecated',
    'sw-select-number-field',
    'sw-password-field-deprecated',
    'sw-number-field-deprecated',
    'sw-email-field-deprecated',
    'sw-compact-colorpicker',
    'sw-entity-tag-select',
    'sw-entity-advanced-selection-modal-grid',
    'sw-multi-tag-ip-select',
    'sw-grouped-single-select',
    'sw-one-to-many-grid',
    'sw-entity-listing',
    'sw-price-preview',
];

describe('src/app/component/index.ts', () => {
    beforeAll(async () => {
        await registerComponents();
    });

    it.each(componentNames)('should register the %s synchronously', (componentName) => {
        expect(Shopware.Component.getComponentRegistry().has(componentName)).toBe(true);
    });

    it.each(componentNames)('should be able to build %s correctly', async (componentName) => {
        const buildResult = await Shopware.Component.build(componentName);
        // If component could not get build then the component library returns "false"
        expect(buildResult).not.toBe(false);
    });
});
